package com.qidian.mespro.mapper;

import com.qidianit.mes.pojo.WorkflowProcess;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface WorkflowProcessMapper {
    //根据工艺id分页查询工艺的工序组成列表
    List<WorkflowProcess> selectList(@Param("workflowId") Long workflowId);

    //新增工序组成
    int addWorkflowProcess(WorkflowProcess workflowProcess);

    //根据id查询工艺工序组成
    WorkflowProcess selectWorkflowProcessById(Long id);

    //根据workflowId和stepOrder查询是否存在重复记录
    int countByWorkflowIdAndStepOrder(@Param("workflowId") Integer workflowId, @Param("stepOrder") Integer stepOrder);

    //编辑工艺的工序组成
    int updateWorkflowProcessById(WorkflowProcess workflowProcess);

    //编辑的查重
    int countByWorkflowIdAndStepOrderExcludeId(@Param("workflowId") Integer workflowId, @Param("stepOrder") Integer stepOrder, @Param("id") Long id);

    //根据工艺的工序组成编号删除单个工序组成
    int deleteWorkflowProcessById(Long id);

    //批量删除工艺的工序组成
    int batchDelete(@Param("ids") Long [] ids);
}
